Skip to content

feat:support --dependency-update before upgrade #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kamilswiec
Copy link

When using helm diff upgrade command when chart dependencies in charts are absent you have to add run helm dep up chart.

I want to be able to pass most of the arguments that I also use in helm upgrade command. This allows me to reduce duplication and ensure helm diff upgrade uses the same flags as helm upgrade be passing the same ${args} variable.

Tested with helm version 3.17.1.

@yxxhero
Copy link
Collaborator

yxxhero commented Apr 28, 2025

@kamilswiec could you add some unit tests for this?

@yxxhero
Copy link
Collaborator

yxxhero commented May 8, 2025

@kamilswiec hi. I will merge this if you can add some tests for this feature. and releae new version.

@yxxhero
Copy link
Collaborator

yxxhero commented May 22, 2025

@kamilswiec ping.

@yxxhero yxxhero requested a review from Copilot August 15, 2025 03:05
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the --dependency-update flag to the helm diff upgrade command, allowing automatic dependency updates before diffing. This eliminates the need to manually run helm dep up chart when chart dependencies are missing and ensures consistency with helm upgrade command arguments.

  • Added --dependency-update boolean flag to the diff command
  • Implemented dependency update execution before running the diff operation
  • Added helper function to execute helm dependency update command

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cmd/upgrade.go Added dependencyUpdate flag field, command line flag registration, and logic to execute dependency update before diffing
cmd/helm3.go Added updateDependencies helper function to execute helm dependency update command

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

return err
} else {
fmt.Println(string(output))
}
Copy link
Preview

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The 'else' clause is unnecessary here since the 'if' block returns early on error. Consider removing the 'else' and unindenting the output printing code for better readability.

Suggested change
}
}
fmt.Println(string(output))

Copilot uses AI. Check for mistakes.

if err != nil {
return err
} else {
fmt.Println(string(output))
Copy link
Preview

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The dependency update output is printed to stdout without any context or formatting. Consider adding a prefix like 'Dependency update:' or using a logger to maintain consistency with other command output formatting in the codebase.

Suggested change
fmt.Println(string(output))
log.Printf("Dependency update: %s", string(output))

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants